package com.sunny.design.factory.pay;

import com.sunny.design.factory.pay.dto.PaymentRequest;

import java.math.BigDecimal;

/**
 * @author Sunny
 * @date 2020/2/24
 */
public class PaymentTest {
    public static void main(String[] args) {
        PaymentFactory aliPaymentFactory = new AliPaymentFactory();
        PaymentFactory wechatPaymentFactory = new WechatPaymentFactory();
        PaymentFactory unionPaymentFactory = new UnionPaymentFactory();
        Payment payment = aliPaymentFactory.createPayment();
        System.out.println(payment.pay(new PaymentRequest("1", new BigDecimal("100"), 1)));

        payment = wechatPaymentFactory.createPayment();
        System.out.println(payment.pay(new PaymentRequest("2", new BigDecimal("100"), 2)));

        payment = unionPaymentFactory.createPayment();
        System.out.println(payment.pay(new PaymentRequest("3", new BigDecimal("100"), 3)));

        PaymentFactory overseasPayment = new VisaPaymentFactory();
        payment = overseasPayment.createPayment();

        System.out.println(payment.pay(new PaymentRequest("4", new BigDecimal("100"), 4)));
    }
}
